package com.ruoyi.accountant.job;

import com.ruoyi.accountant.service.DeviceService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

/***
 * 折旧设备并且产生支出
 */
public class DepreciationDeviceJob extends QuartzJobBean {

    private Logger logger = LoggerFactory.getLogger(DepreciationDeviceJob.class);

    @Autowired
    private DeviceService deviceService;

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        // 如果是月初
        logger.info("设备开始折旧");
        deviceService.deprecate();
        logger.info("设备折旧完成");
    }
}
